import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

public class day_07_IO_ObjectInputStream {
    public static void main(String[] args) throws IOException, ClassNotFoundException{
        // 利用反序列化流，将文件中的对象读取到程序当中

        // 创建反序列化流对象
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("TxtFile\\oss.txt"));
        // 读取数据
        Student stu = (Student) ois.readObject();
        
        System.out.println(stu.toString());
        // 释放资源
        ois.close();
    }
}
